#ifndef __WINDOW_WIN32_HPP____by_Duzy_Chan__
#define __WINDOW_WIN32_HPP____by_Duzy_Chan__ 1
#       include <yisc/gui/window.hpp>
#       include "win32.h"

namespace yisc { namespace gui { namespace win32 {
  
  class window : public yisc::gui::window
  {
  public:
    typedef ::ATOM window_atom_t;
    typedef ::HWND handle_t;
    typedef ::UINT msg_t;

  private:
    static char const * const s_className;
    static window_atom_t s_winAtom;
    static bool register_window_atom_s();
    static LRESULT CALLBACK window_procedure_s(handle_t, msg_t, WPARAM, LPARAM);
    static LRESULT CALLBACK handle_nccreate_s(handle_t, msg_t, WPARAM, LPARAM);

    static inline yisc::gui::window::message_t
    make_msg(msg_t id, WPARAM wPara, LPARAM lPara) {
      yisc::gui::window::message_t m; //msg = { uMsg, wPara, lPara };
      m.id = id;
      m.parameter1 = yisc::gui::window::message_t::parameter_t(wPara);
      m.parameter2 = yisc::gui::window::message_t::parameter_t(lPara);
      return m;
    }

    enum {
      CLASS_STYLE = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,
      WINDOW_STYLE = WS_OVERLAPPEDWINDOW,
      WINDOW_STYLE_EX = WS_EX_APPWINDOW | WS_EX_CLIENTEDGE,
    };

    handle_t handle_;
    static HINSTANCE module_instance_;

  protected:
    virtual bool on_message( yisc::gui::window::message_t& );
    
  public:
    window();
    virtual ~window();

    virtual bool create();
    virtual void show();
    virtual void update();

    virtual bool message_loop();

    static void module_instance( HINSTANCE h );
    static HINSTANCE module_instance();
  };//class window

}//namespace win32
}//namespace gui
}//namespace yisc

#endif//__WINDOW_WIN32_HPP____by_Duzy_Chan__
